Category - Definitions

Query - What definition best describes the term below?

Reversal

Category - Term Recognition

Query - What term does the description below refer to?

(Terms are shown on left, descriptions in middle, figures on right)

Bioenergetics | The quantitative analysis of how organisms gain and use energy. |  | Chemical Potential | (also called partial molar free energy). In a system, the free energy that resides in a chemical component per mole of the component present. For example, in a system consisting of a moles of component A and b moles of component B, the total free energy G would be the sum of the free energy in the two components. |  | Coupled Reaction | A chemical reaction in which one of the products or reactants participates in another chemical reaction. The overall free energy change for the pair of reactions is the sum of the free energy change for each reaction. |  | Endergonic | In a nonisolated system, a process that is accompanied by a positive change in free energy (G) and therefore is thermodynamically not favored. |  | Enthalpy | A thermodynamic quantity (function of state) symbolized by H that is equal to the internal energy of a system plus the product of the pressure and volume: H = E + PV. It is equal to the heat change in constant-pressure reactions, such as most reactions in biological systems. | Figure 3.3 | Entropy | A thermodynamic quantity (function of state) that expresses the degree of disorder or randomness in a system. According to the second law of thermodynamics, in an open system, this tends to increase unless energy is expended to keep the system orderly. | Figure 3.2 | Exergonic | In a nonisolated system, a process that is accompanied by a negative change in free energy (G) and therefore is thermodynamically favored. |  | First Law of Thermodynamics | The law that states that energy cannot be created or destroyed and that it is therefore possible to account for any change in the internal energy of a system E by an exchange of heat ( q) and/or work ( w) with the surroundings. E = q - w. |  | Free Energy | A thermodynamic quantity (function of state), symbolized by G, that takes into account both enthalpy and entropy: G = H - TS where H is enthalpy, S is entropy, and T is absolute temperature. The change in this quantity (G) for a process, such as a chemical reaction, takes into account the changes in enthalpy and entropy and indicates whether the process will be thermodynamically favored at a given temperature. | Figure 3.6 | Internal Energy | The energy contained in a system. For the purposes of biochemistry, the term encompasses all the types of energy that might be changed by chemical or nonnuclear physical processes, including the kinetic energy of motion and vibration of atoms and molecules and the energy stored in bonds and noncovalent interactions. |  | Second Law of Thermodynamics | The law that states that the entropy in a closed system never decreases. An alternative statement is that processes that are thermodynamically favored at constant temperature and pressure involve a decrease in free energy. |  | Standard State | A reference state, with respect to which thermodynamic quantities (such as chemical potentials) are defined. For substances in solution, standard state indicates 1 M concentration at 1 atm pressure and 25 C. |  | State | A term defining the important parameters of a system. Thermodynamically, it is defined by prescribing the amounts of all substances present and any two of the following three variables: the temperature (T), the pressure on the system (P), and the volume of the system (V). |  | System | Any part of the universe chosen for study. It must have defined boundaries, but otherwise there are few restrictions. |  | Tautomerization | The process of forming structural isomers that differ in the location of their hydrogens and double bonds. |

Free Energy Module

This module will test a student's understanding of calculations of Gibbs free energy as they relate to chemical reactions. It has two types of questions it will ask and each type has a randomized setup so that no two problems are exactly the same. It will also show students how the answers were derived. Problems are designed to test a student's knowledge of , G, and the concentrations of products and reactants. The module should provide a crosslink to the Flashcard Testing Module for by sending the value of c=3 to it when passing control.

Student enters module. Screen turns blank, then title fades in - "Free Energy Testing Module". It moves to top of screen and remains there throughout the module's use. The following text appears - "Click HERE to generate a problem to be solved."

Clicking HERE causes screen to clear except for title.

X=Rnd(1)
If X <0.1, Then z2 = 1
Else z2 = 2

The value of z2 sends control to appropriate problem module below

Button for EXIT available

Module 1

In this module, z2=1

This is a relatively simple module based on the equation

= RT lnK, where none of the reactants or products are water or hydrogen ions. Obviously, the reaction is at equilibrium.

The program is designed to randomly pick one of the variables above to ask the student to solve for. The program also randomly assigns values to the other variables so that each time the program is accessed, it gives a different question. Last, the program at the student's prompting will provide the answer to the question and will, if prompted again, show how the answer was derived.

Data Organization

Data for running this module is carried in the data record below:

Data record structure = 1, 1, 7, "For the reaction", "the", "is", null, "°C. What is the", "for the reaction?", 5, "A<=>C", "A+B<=>C", "A+B<=>C+D", "A +ATP <=> C +ADP+ Pi","A+ADP+Pi <=> C+ATP"

Data record variables and explanation

This data is stored in variables as follows:

rn, rt, vsn, V$(1 to vsn), rsn, RS$(1 to rsn)

Variable Descriptions

rn = reaction number - if this were the first reaction in the database, rn would be 1.
rt = reaction type - is a number that corresponds to this type of problem. Is used by module to show answers.
vsn=number of variable strings - this reaction had 6 strings, which are listed in the record structure
rsn = number of reaction strings - these are strings describing the reaction, for example A<=>B.

Program Operation and Output

V1$(1)= "equilibrium constant k"
V1$(2)= ""
V$(4)= " at "
s9 = 1
Let z9=Rnd(1)
Let z7=Rnd(1)
If z9<0.5 then f=40*Rnd(1) and V$(4) = " kJ/mole at " and n=1 and n1=2 and s9 = 1*(z7>0.5) and f=f*s9
Else f=20*Rnd(1) and n=2 and n1=1 and If z7<0.5, then f=1/f
Let z8=Int(rsn*Rnd(1)+1)
Let t=Rnd(38*Rnd(1))

[[[[[The following section causes the initial question to be printed on the screen.]]]]]]]]
For j=1 to vsn
Print V$(j) (no line feeds)
If j=1 then Print RS(z8) (no line feeds)
If j=2 then Print V1$(n) (no line feeds)
If j=3 then Print s9*f (no line feeds)
If j=4 then Print t (no line feeds)
If j=5 then Print V1$(n1) (no line feeds)
Next j

This will cause a sentence looking something like the following to be printed on the screen:

"For the reaction A<=> C, the equilibrium constant K is 10 at 21°C. Assuming no water or protons are involved in the reaction, what is the for this reaction?"

A button is available with the word ANSWER. Clicking it brings up the answer, which is calculated according to whether n=1 or n=2:

Case n=1

If n=1 the answer is a calculation of . In this case, = -r*(t+273)*ln(f) where r is the gas constant (.00831451 kJ/mol°K). The answer to the problem will be in units of kJ/mol.

Button for See How Problem Was Calculated - sends control to Problem Mode 1 Calculations n=1 below
Button for Another Problem This Type - clears screen returns control to beginning of program
Button for Different Type of Problem
Button for Exit - exits from program

Case n=2

If n=2 the answer is a calculation of K. In this case, K=e^ - (f/r(t+273))

Button for See How Problem Was Calculated - sends control to Problem Mode 1 Calculations n=2 below
Button for Another Problem This Type - clears screen returns control to beginning of program
Button for Different Type of Problem
Button for Exit - exits from program

Problem Mode 1 Calculations n=1

Print "At equilibrium, = -RTln(K) . This is obtained by rearranging Equation 3.26 in the text. R is the gas constant, which is .00831451 kJ/mol°K. T is the temperature in °Kelvin ", (t+273)" here, which was obtained by the relationship °K = °C +273. Plugging in the numbers,
= (.00831451 kJ/mol°K) * ("(t+273)")*ln ("f")"

Cancelling units gives

= "-r*(t+273)*ln(f) " kJ/mol"

Problem Mode 1 Calculations n=2

Print "At equilibrium, K = e^ - (/RT). This is the same as equation 3.27. R is the gas constant, which is .00831451 kJ/mol°K. T is the temperature in °Kelvin ", (t+273)" here, which was obtained by the relationship °K = °C +273. Plugging in the numbers,

K = e^ - ("f"/"r"*("(t+273)") = "e^ - (f/r(t+273))

Button for Another Problem This Type - clears screen returns control to beginning of this module
Button for Different Type of Problem
Button for Exit - exits from program

Module 2

In this module, z2=2. The program is designed to test a student's ability to solve the Gibb's Free Energy Equation, G = + RTln(Prod/Reactants), where none of the reactants or products are water or hydrogen ions.. It will randomly pick several different equation types and will randomize values of the independent variables to create a new problem each time the program is run. It will randomly pick one of the variables as the dependent variable, requiring the student to be able to solve the equation in every possible way. In each case, the student will need to identify the direction in which the reaction is proceeding under the conditions chosen. To run the program, it must use a different data structure described below.

Data structure:

Organization of data elements are as follows:

2, 2, 24, "For the reaction", "the following data are known", "G ", " ", "Temperature (T) ", "[A] ", "[B] ", "[C] ", "[D] ", "[E] ", "[Z] ", "R=0.00831451 J/°K/mol", " mM", " = ", " + ", " R ", " T ", "ln", "(", ")", "/", "[", "]", "^2"5, "A<=>B", "A+B<=>C", "A+B<=>C+D", "A +B <=> C +D+E","A+B+2Z <=> C+D", 3, "kJ/mol", "°Kelvin", "mM"

This is read into the variables as follows

rn,rt, rsn, V$(1 to rsn), vsn, RS$(1 to vsn), usn, U$(1 to USN)

V$(1 to rsn) contains the basic name and question strings
RS$(1 to vsn) contains the basic reaction strings
U$(1 to USN) contains the unit strings

Randomizations

At the beginning of each problem, a set of randomizations must be done

For j=3 to 11
R(j) = Rnd (1)
Next j

In addition, the following non-array variables are assigned

r13 = Int(5*Rnd(1) + 1) - establishes reaction case
r14 = -1*(Rnd(1)>0.5) - Establishes sign +/-
r15 = Int((3+RC(r13)+PC(r13))*Rnd(1)+1) - used to identify dependent variable below

These are assigned values as necessary below

R(3) = 8*R(3)*R(14) = G - to 2 significant digits
R(4) = 8*R(4)*R(14) = - to 2 significant digits
R(5) = Int(R3(3)*37)+273 = Temperature
R(6) = R(6)*10 = [A] - to 2 significant digits
R(7) = R(7)*10 = [B] - to 2 significant digits
R(8) = R(8)*10 = [C] - to 2 significant digits
R(9) = R(9)*10 = [D] - to 2 significant digits
R(10) = R(10)*10 = [E] - to 2 significant digits
R(11) = R(11)*4 = [Z] - to 2 significant digits

Also, R(1) is assigned the value of the gas constant, 0.00831451

The five possible reaction cases are

Reaction Case #1 = A<=>B
Reaction Case #2 =A+B<=>C
Reaction Case #3 =A+B<=>C+D
Reaction Case #4 =A +B <=> C +D+E
Reaction Case #5 =A+B+2Z <=> C+D

The RC(r13) array below keeps track of the number of reactants in Reaction Case #r13

RC(1) = 1
RC(2) = 2
RC(3) = 2
RC(4) = 2
RC(5) = 3

The PC(r13) array below counts the number of products in Reaction Case #r13

PC(1) = 1
PC(2) = 1
PC(3) = 2
PC(4) = 3
PC(5) = 2

The 2D arrays RJ(r13,n) and PJ(r13,n) identify the array number 'n' of the each reactant and product respectively

RJ(1,1) = 6, PJ(1,1) = 8
RJ(2,1) = 6, RJ(2,2) = 7, PJ(2,1) = 8
RJ(3,1) = 6, RJ(3,2) = 7, PJ(3,1) = 8, PJ(3,2) =9
RJ(4,1) = 6, RJ(4,2) = 7, PJ(4,1) = 8, PJ(4,2) = 9, PJ(4,3) = 10
RJ(5,1) = 6, RJ(5,2) = 7, RJ(5,3) = 11, PJ(5,1) = 8, PJ(5,2) = 9

Given this organization, the following subroutine will print the Gibbs Free Energy equation for the reaction type r13 on the screen

d=0
e=0
For k=3 to 11
D$ = null
For m=1 to 3
If V$(k) = V$(PJ(r13, m), Then D$ = V$(22) + V$(k) + V$(23) and d=d+1
Next m
For m=1 to 3
If V$(k) = V$(RJ(r13, m), Then D$ = V$(22) + V$(k) + V$(23) and e=e+1 and If k=11, Then D$ = V$(22)+V$(k)+V$(24)+V$(23)
Next m
If k<5 then D$=V$(k)
Print D$ (no line feeds)
If d= PC(r13) then Print V$(20)+V$(21) +V$(19) and d=0
If e= RC(r13) then Print V$(20) and e=0
If k=3, Print V$(14) (no line feeds)
If k=4, Print V$(15), V$(16), V$(17), V$(18), V$(19) (no line Feeds)
Next k

[[[[[This routine above is not actually used in what I did below, but I include it because it was helpful for me to organize things with it and it may be of use to you.]]]]]

Having established the Reaction Case (r13) and the dependent variable number (r15), it is necessary to identify all of the variables used in the calculations, since these can change from one Reaction Case to another. The total number of variables corresponds to the sum of 3 (G, , and T) plus the number of product variables (PC(r13) plus the number of reactant variables (RC(r13). Assignments are done with the routine below:

For j= 1 to 3
RR(j)=j+2
Next j
For j=4 to (3+PC(r13))
RR(j)=PJ(r13, (j-3))
Next j
For j=(4+PC(r13)) to (3+PC(r13)+RC(r13))
RR(j)=RJ(r13, (j-3-PC(r13))
Next j

At the end of this, the array RR(m) will sequentially carry values in it of the array number of every item relevant to the equation. The array number used in the String array (V$(x)) also equals the number used in the value string (R(x)). Thus, RR(1) will return the array number of the first string of the equations (this is '3'), R(RR(1)) will return the value of the first item (randomized value of G), and V$(RR(1)) will return the string 'G'. The array number of the dependent variable is given by RR(r15). Last, the array number of the units string will be given by UU(RR(x)) - see below.

Assign Unit Strings

We must also assign Unit strings for reporting values. For example, answers for G should be reported in kJ/mol, and Temperature in °K (or °C), etc. With the next routine, we assign the unit string (U$(x) ) values as appropriate.

UU(3) = 1
UU(4) = 1
UU(5) = 2
UU(6) = 3
UU(7) = 3
UU(8) = 3
UU(9) = 3
UU(10) = 3
UU(11) = 3

Thus, the Unit string for G is V$(UU(RR(1))) = kJ/mol.

User Entry Point

We are now ready to begin description of how the program runs. Upon entry, the program prints the following for the user:

"For the reaction " RS$(r13) ", the following data are known:"

Now the program will print a list of the independent variables and their values

For j = 1 to (3+PC(r13)+RC(r13))
If j = r15, Then Next j
Print V$(RR(j))+V$(14), R(RR(j))
Next j

Now the program prints the two questions,

"1. What would the " V$(RR(r15))" be for this reaction?
2. Will the reaction go to the right or left as written?"

The screen shows a single ANSWER button

Identifying and Calculating Dependent Variable

In order to calculate the answer, the program must calculate the value of the dependent variable.

Note that the system is initially set up to assign a random value to all of the variables. That is, all of the variables are initially independent of each other. Obviously, if these were not related to each other, the Gibb's Free Energy equation would make no sense. To make sense in the equation, the dependent variable is set up to change its value from the initial random value to a value that depends on the values of the other independent variables as specified by the Gibbs Free Energy Equation. Thus, the equation is valid.

To illustrate how the program identifies the random dependent variable, consider one possible iteration of it. After randomization, r13=3. This establishes the equation A+B<=>C+D as the equation to be used. This equation has two products, C (random value in R(8)) and D (random value in R(9)) and two reactants, A (random value in R(6)) and B (random value in R(7)). Number of products are counted in the program by the value of PC(r13)=PC(3)=2. Number of reactants are counted in the program by the value of RC(r13)=RC(3)=2. Thus, the program knows it has seven variables. The other variables are G, given by R(3), , given by R(4), and T, given by R(5). The program looks at the number of products and reactants and aligns them as follows:

R(3) = Variable #1
R(4) = Variable #2
R(5) = Variable #3
R(8) = Variable #4
R(9) = Variable #5
R(6) = Variable #6
R(7) = Variable #7

Since the program knows there are seven variables, it picks a random number between 1 and 7 and puts it into the variable r15. Let's say in this case that r15=3. This means that the 3rd variable will be the dependent one. The third variable is the temperature, R(5). Next, the program must solve the equation in terms of the dependent variable. There are 6 possible scenarios to solving any of the Gibbs equations that we have defined. These correspond to the 6 types of variables in the equations we have used:

G = Scenario #1
= Scenario #2
T = Scenario #3
Product = Scenario #4
Reactant A or B = Scenario #5
Reactant Z = Scenario #6

Note that Reactant Z is a different type of variable than A or B, because solving the equation in terms of Z gives a different arrangement than A or B.

In this example, scenario #3 is chosen. For this case, the original random value of R(5) is ignored, and T (R(5)) is recalculated as

R(5) = {R(3)-R(4)}/{R(1)*ln{([R(8)*R(9))/(R(6)*R(7))}

Similarly, each scenario has its own solution. All that the program has to do is route control to the appropriate solution according to which variable variable is the dependent one.

The table below shows which routine handles which dependent variable

Dependent Variable Routine
G (R(3)) 1
(R(4)) 2
Temperature (R(5)) 3
[A] (R(6)) 4
[B] (R((7)) 4
[C] (R(8)) 5
[D] (R(9)) 5
[E] (R(10)) 5
[Z] (R(11)) 6

We create another array below reflecting these values

T(3) = 1
T(4) = 2
T(5) = 3
T(6) = 4
T(7) = 4
T(8) = 5
T(9) = 5
T(10) = 5
T(11) = 6

Next, we specify what the solutions to the 6 scenarios are. Notice, for example, that the solutions for the variables [A] and [B] are listed under the same scenario, but the solution for each of these is not the same - it depends on the other variable. We also need to remember that some equation forms will not even have a [B] term, for example. The program will have to keep track of all this.

So, upon pressing the ANSWER button, the program is sent to the appropriate Answer Scenario below according to the value of T(RR(r15)).

Answer Scenario 1

Here, the dependent variable is G. Solving for G,

G = + RTln (Prod/React)

First, we define the product of the concentrations of reactants and products.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
pp=pp*R(PJ(r13,j))
Next j

[[[[Note that the term If r13 = 5 Then rr=rr*RJ(r13,3) is necessary to allow for the situation where [Z] is present and the quantity must be squared.]]]]

The solution to the equation then is given by

R(3) = R(4) + R(1)*R(5)*ln(pp/rr)

Send control to Response module below

Answer Scenario 2

Here the dependent variable is

= G - RTln (Prod/React)

First, we define the product of the concentrations of reactants and products, as before.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
pp=pp*R(PJ(r13,j))
Next j

The solution to the equation then is given by

R(4) = R(3) - R(1)*R(5)*ln(pp/rr)

Send control to Response module below

Answer Scenario 3

Here the dependent variable is the temperature.

T = (G - )/(R*ln(Prod/React))

First, we define the product of the concentrations of reactants and products, as before.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
pp=pp*R(PJ(r13,j))
Next j

The solution to the equation then is given by

R(5) = {R(3)-R(4)}/{R(1)*ln(pp/rr)}

Send control to Response module below

Answer Scenario 4

Here the dependent variable is the reactant A or B. The general solution to this is

[A or B] = Products/(e^((G-)/RT))[Remaining reactants, if any]
We can still run the products/reactants subroutine, but if we iterate to the dependent variable, we do not want it multiplied as part of the reactant multiplication variable rr. Thus, we have to add another qualification in the loop for the reactants, as shown below.

rr=1
pp=1
For j = 1 to RC(r13)
If RR(r15) = RJ(r13,j), Then Next j
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*RJ(r13,3)
For j=1 to PC(r13)
pp=pp*R(PJ (r13,j))
Next j

Now, we put the value of the calculation into the dependent variable (whichever one that happens to be),

R(RR(r15)) = pp/(e^((R(3)-R(4)/(R(1)*R(5))*rr)

Send control to Response module below

Answer Scenario 5

Here the dependent variable is the product C or D. The general solution to this is given by

[C or D] = (e^((G-)/RT))*[A]*[B]/[Remaining product, if any]

As in scenario 4, we can still run the products/reactants subroutine, but if we iterate to the dependent variable, we do not want it multiplied as part of the product multiplication variable pp. Thus, we have to add another qualification in the loop for the products, as shown below.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
If RR(r15) = PJ(r13,j), Then Next j
pp=pp*R(PJ (r13,j))
Next j

Send control to Response module below

Answer Scenario 6

Here the dependent variable is the variable [Z]. Since this term has a coefficient of 2 in the reaction equation, it is solved differently than the other reactants. The general solution for [Z] is

[Z] = ((Products/Reactants)*e^((G-)/RT))^0.5

Here we do not want to include the Z^2 in the variable rr, so we simply eliminate the If r13=5, Then rr=rr*R(RJ(r13,3)) statement from before. By iterating j only to 2 in the rr equation loop below, we eliminate the other possibility of incorporating the [Z] term.

rr=1
pp=1
For j = 1 to 2
rr = rr*R(RJ(r13,j))
Next j
For j=1 to PC(r13)
pp=pp*R(PJ (r13,j))
Next j

Send control to Response module below

Response

Now the program is set to deliver the answer. When the ANSWER button is pressed, the program responds as follows:

V$(RR(r15)) "=" R(RR(r15)) "U$(UU(RR(r15))

[[[[[[This should print out something like

G = xxx kJ/mol]]]]]]

Next, the program must answer the question about reaction direction. This is very simple, no matter what the calculation, if G<0 then the reaction moves to the right. If G = 0 there is no net movement. If G>0, then reaction movement is to the left.

If R(3)>0, Then DD$ = " to the left "
If R(3) = 0, Then DD$ = " neither left nor right "
If R(3) <0, Then DD$ = " to the right "
If Abs(R(3))<0.1 and R(3)<>0, then Print "The reaction is very close to equilibrium, but will move slightly DD$, because G = "R(3)
Else Print "The reaction moves" DD$ "because G = "R(3)

A button should be available stating SEE HOW PROBLEM SOLVED

Pressing this button should send control to Solution Scenarios below with the same number as the original Answer Scenario above.

Solution Scenario 1

Screen clears except for title.

Print "The answer was derived from the Gibbs Free Energy equation,

G = + RTln (Products/Reactants)

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives

G =" R(4) "+" R(1)"*"R(5)"*ln("

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/("
For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ").

Thus, G = "R(3), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 2

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:

= G - RTln (Products/Reactants)

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives

=" R(3) "+" R(1)"*"R(5)"*ln("

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/("
For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ").

Thus, = "R(4), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 3

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:

T = (G - )/{R*ln(Products/Reactants)}

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives

T = ("R(3)" - "R(4)")/{"R(1)"*ln(

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/("
For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ").

Thus, T = "R(5), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 4

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:"

V$(RR(r15)) "= ("

For j = 1 to PC(r13)
Print V$(PJ(r13,j) (no line feed)
Next j

Print ")/{e^((G - )/RT)"

For j = 1 to RC(r13)
If j=r15, Then Next j
Print V$(RJ(r13,j) (no line feed)
Next j

Print "}.

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives " V$(RR(r15))" = "

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/{e^(("R(3)"-"R(4)")/("R(1)"*(R(5))

For j = 1 to RC(r13)
Print "*"R(RJ(r13,j) (no line feed)
Next j

Print "}

Thus," V$(RR(r15)) "= "R(RR(r(15))), U$(UU(RR(r15)))
Button available ANOTHER PROBLEM
Button available EXIT
Solution Scenario 5

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:"

V$(RR(r15)) "= (e^((G - )/RT))*("

For j = 1 to RC(r13)
Print V$(RJ(r13,j) (no line feed)
Next j

Print ")"

For j = 1 to PC(r13)
If j=r15, Then Next j
Print "/"V$(PJ(r13,j) (no line feed)
Next j

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives " V$(RR(r15))" = (e^(("R(3)"-"R(4)")/"R(1)"*"R(5)")*(

For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ")"

For j = 1 to PC(r13)
If j=r15, Then Next j
Print "/"R(PJ(r13,j) (no line feed)
Next j

Print "Thus," V$(RR(r15)) "= "R(RR(r(15))), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 6
Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:

[Z] = (([C][D]/([A][B]))*(e^((G - )/RT))^0.5

[[[[[[Note = it would be very nice to have a square root symbol to use here instead of ^0.5]]]]]]

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives " V$(RR(r15)) "=(("R(8)"*"R(9)")/("R(6)"*"R(7)"))*e^(("R(3)" "R(4)")/("R(1)"*"R(5)")"

Print "Thus," V$(RR(r15)) "= "R(RR(r(15))), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

n=2

Print "At equilibrium, K = e^ - (/RT). This is the same as equation 3.27. R is the gas constant, which is .00831451 kJ/mol°K. T is the temperature in °Kelvin ", (t+273)" here, which was obtained by the relationship °K = °C +273. Plugging in the numbers,

K = e^ - ("f"/"r"*("(t+273)") = "e^ - (f/r(t+273))

Button for Another Problem This Type - clears screen returns control to beginning of this module
Button for Different Type of Problem
Button for Exit - exits from program

Module 2

In this module, z2=2. The program is designed to test a student's ability to solve the Gibb's Free Energy Equation, G = + RTln(Prod/Reactants), where none of the reactants or products are water or hydrogen ions.. It will randomly pick several different equation types and will randomize values of the independent variables to create a new problem each time the program is run. It will randomly pick one of the variables as the dependent variable, requiring the student to be able to solve the equation in every possible way. In each case, the student will need to identify the direction in which the reaction is proceeding under the conditions chosen. To run the program, it must use a different data structure described below.

Data structure:

Organization of data elements are as follows:

2, 2, 24, "For the reaction", "the following data are known", "G ", " ", "Temperature (T) ", "[A] ", "[B] ", "[C] ", "[D] ", "[E] ", "[Z] ", "R=0.00831451 J/°K/mol", " mM", " = ", " + ", " R ", " T ", "ln", "(", ")", "/", "[", "]", "^2"5, "A<=>B", "A+B<=>C", "A+B<=>C+D", "A +B <=> C +D+E","A+B+2Z <=> C+D", 3, "kJ/mol", "°Kelvin", "mM"

This is read into the variables as follows

rn,rt, rsn, V$(1 to rsn), vsn, RS$(1 to vsn), usn, U$(1 to USN)

V$(1 to rsn) contains the basic name and question strings
RS$(1 to vsn) contains the basic reaction strings
U$(1 to USN) contains the unit strings

Randomizations

At the beginning of each problem, a set of randomizations must be done

For j=3 to 11
R(j) = Rnd (1)
Next j

In addition, the following non-array variables are assigned

r13 = Int(5*Rnd(1) + 1) - establishes reaction case
r14 = -1*(Rnd(1)>0.5) - Establishes sign +/-
r15 = Int((3+RC(r13)+PC(r13))*Rnd(1)+1) - used to identify dependent variable below

These are assigned values as necessary below

R(3) = 8*R(3)*R(14) = G - to 2 significant digits
R(4) = 8*R(4)*R(14) = - to 2 significant digits
R(5) = Int(R3(3)*37)+273 = Temperature
R(6) = R(6)*10 = [A] - to 2 significant digits
R(7) = R(7)*10 = [B] - to 2 significant digits
R(8) = R(8)*10 = [C] - to 2 significant digits
R(9) = R(9)*10 = [D] - to 2 significant digits
R(10) = R(10)*10 = [E] - to 2 significant digits
R(11) = R(11)*4 = [Z] - to 2 significant digits

Also, R(1) is assigned the value of the gas constant, 0.00831451

The five possible reaction cases are

Reaction Case #1 = A<=>B
Reaction Case #2 =A+B<=>C
Reaction Case #3 =A+B<=>C+D
Reaction Case #4 =A +B <=> C +D+E
Reaction Case #5 =A+B+2Z <=> C+D

The RC(r13) array below keeps track of the number of reactants in Reaction Case #r13

RC(1) = 1
RC(2) = 2
RC(3) = 2
RC(4) = 2
RC(5) = 3

The PC(r13) array below counts the number of products in Reaction Case #r13

PC(1) = 1
PC(2) = 1
PC(3) = 2
PC(4) = 3
PC(5) = 2

The 2D arrays RJ(r13,n) and PJ(r13,n) identify the array number 'n' of the each reactant and product respectively

RJ(1,1) = 6, PJ(1,1) = 8
RJ(2,1) = 6, RJ(2,2) = 7, PJ(2,1) = 8
RJ(3,1) = 6, RJ(3,2) = 7, PJ(3,1) = 8, PJ(3,2) =9
RJ(4,1) = 6, RJ(4,2) = 7, PJ(4,1) = 8, PJ(4,2) = 9, PJ(4,3) = 10
RJ(5,1) = 6, RJ(5,2) = 7, RJ(5,3) = 11, PJ(5,1) = 8, PJ(5,2) = 9

Given this organization, the following subroutine will print the Gibbs Free Energy equation for the reaction type r13 on the screen

d=0
e=0
For k=3 to 11
D$ = null
For m=1 to 3
If V$(k) = V$(PJ(r13, m), Then D$ = V$(22) + V$(k) + V$(23) and d=d+1
Next m
For m=1 to 3
If V$(k) = V$(RJ(r13, m), Then D$ = V$(22) + V$(k) + V$(23) and e=e+1 and If k=11, Then D$ = V$(22)+V$(k)+V$(24)+V$(23)
Next m
If k<5 then D$=V$(k)
Print D$ (no line feeds)
If d= PC(r13) then Print V$(20)+V$(21) +V$(19) and d=0
If e= RC(r13) then Print V$(20) and e=0
If k=3, Print V$(14) (no line feeds)
If k=4, Print V$(15), V$(16), V$(17), V$(18), V$(19) (no line Feeds)
Next k

[[[[[This routine above is not actually used in what I did below, but I include it because it was helpful for me to organize things with it and it may be of use to you.]]]]]

Having established the Reaction Case (r13) and the dependent variable number (r15), it is necessary to identify all of the variables used in the calculations, since these can change from one Reaction Case to another. The total number of variables corresponds to the sum of 3 (G, , and T) plus the number of product variables (PC(r13) plus the number of reactant variables (RC(r13). Assignments are done with the routine below:

For j= 1 to 3
RR(j)=j+2
Next j
For j=4 to (3+PC(r13))
RR(j)=PJ(r13, (j-3))
Next j
For j=(4+PC(r13)) to (3+PC(r13)+RC(r13))
RR(j)=RJ(r13, (j-3-PC(r13))
Next j

At the end of this, the array RR(m) will sequentially carry values in it of the array number of every item relevant to the equation. The array number used in the String array (V$(x)) also equals the number used in the value string (R(x)). Thus, RR(1) will return the array number of the first string of the equations (this is '3'), R(RR(1)) will return the value of the first item (randomized value of G), and V$(RR(1)) will return the string 'G'. The array number of the dependent variable is given by RR(r15). Last, the array number of the units string will be given by UU(RR(x)) - see below.

Assign Unit Strings

We must also assign Unit strings for reporting values. For example, answers for G should be reported in kJ/mol, and Temperature in °K (or °C), etc. With the next routine, we assign the unit string (U$(x) ) values as appropriate.

UU(3) = 1
UU(4) = 1
UU(5) = 2
UU(6) = 3
UU(7) = 3
UU(8) = 3
UU(9) = 3
UU(10) = 3
UU(11) = 3

Thus, the Unit string for G is V$(UU(RR(1))) = kJ/mol.

User Entry Point

We are now ready to begin description of how the program runs. Upon entry, the program prints the following for the user:

"For the reaction " RS$(r13) ", the following data are known:"

Now the program will print a list of the independent variables and their values

For j = 1 to (3+PC(r13)+RC(r13))
If j = r15, Then Next j
Print V$(RR(j))+V$(14), R(RR(j))
Next j

Now the program prints the two questions,

"1. What would the " V$(RR(r15))" be for this reaction?
2. Will the reaction go to the right or left as written?"

The screen shows a single ANSWER button

Identifying and Calculating Dependent Variable

In order to calculate the answer, the program must calculate the value of the dependent variable.

Note that the system is initially set up to assign a random value to all of the variables. That is, all of the variables are initially independent of each other. Obviously, if these were not related to each other, the Gibb's Free Energy equation would make no sense. To make sense in the equation, the dependent variable is set up to change its value from the initial random value to a value that depends on the values of the other independent variables as specified by the Gibbs Free Energy Equation. Thus, the equation is valid.

To illustrate how the program identifies the random dependent variable, consider one possible iteration of it. After randomization, r13=3. This establishes the equation A+B<=>C+D as the equation to be used. This equation has two products, C (random value in R(8)) and D (random value in R(9)) and two reactants, A (random value in R(6)) and B (random value in R(7)). Number of products are counted in the program by the value of PC(r13)=PC(3)=2. Number of reactants are counted in the program by the value of RC(r13)=RC(3)=2. Thus, the program knows it has seven variables. The other variables are G, given by R(3), , given by R(4), and T, given by R(5). The program looks at the number of products and reactants and aligns them as follows:

R(3) = Variable #1
R(4) = Variable #2
R(5) = Variable #3
R(8) = Variable #4
R(9) = Variable #5
R(6) = Variable #6
R(7) = Variable #7

Since the program knows there are seven variables, it picks a random number between 1 and 7 and puts it into the variable r15. Let's say in this case that r15=3. This means that the 3rd variable will be the dependent one. The third variable is the temperature, R(5). Next, the program must solve the equation in terms of the dependent variable. There are 6 possible scenarios to solving any of the Gibbs equations that we have defined. These correspond to the 6 types of variables in the equations we have used:

G = Scenario #1
= Scenario #2
T = Scenario #3
Product = Scenario #4
Reactant A or B = Scenario #5
Reactant Z = Scenario #6

Note that Reactant Z is a different type of variable than A or B, because solving the equation in terms of Z gives a different arrangement than A or B.

In this example, scenario #3 is chosen. For this case, the original random value of R(5) is ignored, and T (R(5)) is recalculated as

R(5) = {R(3)-R(4)}/{R(1)*ln{([R(8)*R(9))/(R(6)*R(7))}

Similarly, each scenario has its own solution. All that the program has to do is route control to the appropriate solution according to which variable variable is the dependent one.

The table below shows which routine handles which dependent variable

Dependent Variable Routine
G (R(3)) 1
(R(4)) 2
Temperature (R(5)) 3
[A] (R(6)) 4
[B] (R((7)) 4
[C] (R(8)) 5
[D] (R(9)) 5
[E] (R(10)) 5
[Z] (R(11)) 6

We create another array below reflecting these values

T(3) = 1
T(4) = 2
T(5) = 3
T(6) = 4
T(7) = 4
T(8) = 5
T(9) = 5
T(10) = 5
T(11) = 6

Next, we specify what the solutions to the 6 scenarios are. Notice, for example, that the solutions for the variables [A] and [B] are listed under the same scenario, but the solution for each of these is not the same - it depends on the other variable. We also need to remember that some equation forms will not even have a [B] term, for example. The program will have to keep track of all this.

So, upon pressing the ANSWER button, the program is sent to the appropriate Answer Scenario below according to the value of T(RR(r15)).

Answer Scenario 1

Here, the dependent variable is G. Solving for G,

G = + RTln (Prod/React)

First, we define the product of the concentrations of reactants and products.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
pp=pp*R(PJ(r13,j))
Next j

[[[[Note that the term If r13 = 5 Then rr=rr*RJ(r13,3) is necessary to allow for the situation where [Z] is present and the quantity must be squared.]]]]

The solution to the equation then is given by

R(3) = R(4) + R(1)*R(5)*ln(pp/rr)

Send control to Response module below

Answer Scenario 2

Here the dependent variable is

= G - RTln (Prod/React)

First, we define the product of the concentrations of reactants and products, as before.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
pp=pp*R(PJ(r13,j))
Next j

The solution to the equation then is given by

R(4) = R(3) - R(1)*R(5)*ln(pp/rr)

Send control to Response module below

Answer Scenario 3

Here the dependent variable is the temperature.

T = (G - )/(R*ln(Prod/React))

First, we define the product of the concentrations of reactants and products, as before.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
pp=pp*R(PJ(r13,j))
Next j

The solution to the equation then is given by

R(5) = {R(3)-R(4)}/{R(1)*ln(pp/rr)}

Send control to Response module below

Answer Scenario 4

Here the dependent variable is the reactant A or B. The general solution to this is

[A or B] = Products/(e^((G-)/RT))[Remaining reactants, if any]
We can still run the products/reactants subroutine, but if we iterate to the dependent variable, we do not want it multiplied as part of the reactant multiplication variable rr. Thus, we have to add another qualification in the loop for the reactants, as shown below.

rr=1
pp=1
For j = 1 to RC(r13)
If RR(r15) = RJ(r13,j), Then Next j
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*RJ(r13,3)
For j=1 to PC(r13)
pp=pp*R(PJ (r13,j))
Next j

Now, we put the value of the calculation into the dependent variable (whichever one that happens to be),

R(RR(r15)) = pp/(e^((R(3)-R(4)/(R(1)*R(5))*rr)

Send control to Response module below

Answer Scenario 5

Here the dependent variable is the product C or D. The general solution to this is given by

[C or D] = (e^((G-)/RT))*[A]*[B]/[Remaining product, if any]

As in scenario 4, we can still run the products/reactants subroutine, but if we iterate to the dependent variable, we do not want it multiplied as part of the product multiplication variable pp. Thus, we have to add another qualification in the loop for the products, as shown below.

rr=1
pp=1
For j = 1 to RC(r13)
rr = rr*R(RJ(r13,j))
Next j
If r13=5, Then rr=rr*R(RJ(r13,3))
For j=1 to PC(r13)
If RR(r15) = PJ(r13,j), Then Next j
pp=pp*R(PJ (r13,j))
Next j

Send control to Response module below

Answer Scenario 6

Here the dependent variable is the variable [Z]. Since this term has a coefficient of 2 in the reaction equation, it is solved differently than the other reactants. The general solution for [Z] is

[Z] = ((Products/Reactants)*e^((G-)/RT))^0.5

Here we do not want to include the Z^2 in the variable rr, so we simply eliminate the If r13=5, Then rr=rr*R(RJ(r13,3)) statement from before. By iterating j only to 2 in the rr equation loop below, we eliminate the other possibility of incorporating the [Z] term.

rr=1
pp=1
For j = 1 to 2
rr = rr*R(RJ(r13,j))
Next j
For j=1 to PC(r13)
pp=pp*R(PJ (r13,j))
Next j

Send control to Response module below

Response

Now the program is set to deliver the answer. When the ANSWER button is pressed, the program responds as follows:

V$(RR(r15)) "=" R(RR(r15)) "U$(UU(RR(r15))

[[[[[[This should print out something like

G = xxx kJ/mol]]]]]]

Next, the program must answer the question about reaction direction. This is very simple, no matter what the calculation, if G<0 then the reaction moves to the right. If G = 0 there is no net movement. If G>0, then reaction movement is to the left.

If R(3)>0, Then DD$ = " to the left "
If R(3) = 0, Then DD$ = " neither left nor right "
If R(3) <0, Then DD$ = " to the right "
If Abs(R(3))<0.1 and R(3)<>0, then Print "The reaction is very close to equilibrium, but will move slightly DD$, because G = "R(3)
Else Print "The reaction moves" DD$ "because G = "R(3)

A button should be available stating SEE HOW PROBLEM SOLVED

Pressing this button should send control to Solution Scenarios below with the same number as the original Answer Scenario above.

Solution Scenario 1

Screen clears except for title.

Print "The answer was derived from the Gibbs Free Energy equation,

G = + RTln (Products/Reactants)

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives

G =" R(4) "+" R(1)"*"R(5)"*ln("

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/("
For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ").

Thus, G = "R(3), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 2

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:

= G - RTln (Products/Reactants)

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives

=" R(3) "+" R(1)"*"R(5)"*ln("

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/("
For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ").

Thus, = "R(4), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 3

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:

T = (G - )/{R*ln(Products/Reactants)}

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives

T = ("R(3)" - "R(4)")/{"R(1)"*ln(

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/("
For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ").

Thus, T = "R(5), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 4

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:"

V$(RR(r15)) "= ("

For j = 1 to PC(r13)
Print V$(PJ(r13,j) (no line feed)
Next j

Print ")/{e^((G - )/RT)"

For j = 1 to RC(r13)
If j=r15, Then Next j
Print V$(RJ(r13,j) (no line feed)
Next j

Print "}.

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives " V$(RR(r15))" = "

For j = 1 to PC(r13)
Print R(PJ(r13,j) (no line feed)
Next j

Print ")/{e^(("R(3)"-"R(4)")/("R(1)"*(R(5))

For j = 1 to RC(r13)
Print "*"R(RJ(r13,j) (no line feed)
Next j

Print "}

Thus," V$(RR(r15)) "= "R(RR(r(15))), U$(UU(RR(r15)))
Button available ANOTHER PROBLEM
Button available EXIT
Solution Scenario 5

Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:"

V$(RR(r15)) "= (e^((G - )/RT))*("

For j = 1 to RC(r13)
Print V$(RJ(r13,j) (no line feed)
Next j

Print ")"

For j = 1 to PC(r13)
If j=r15, Then Next j
Print "/"V$(PJ(r13,j) (no line feed)
Next j

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives " V$(RR(r15))" = (e^(("R(3)"-"R(4)")/"R(1)"*"R(5)")*(

For j = 1 to RC(r13)
Print R(RJ(r13,j) (no line feed)
Next j

Print ")"

For j = 1 to PC(r13)
If j=r15, Then Next j
Print "/"R(PJ(r13,j) (no line feed)
Next j

Print "Thus," V$(RR(r15)) "= "R(RR(r(15))), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT

Solution Scenario 6
Screen clears except for title.

Print "The answer was derived by rearranging the Gibbs Free Energy equation as follows:

[Z] = (([C][D]/([A][B]))*(e^((G - )/RT))^0.5

[[[[[[Note = it would be very nice to have a square root symbol to use here instead of ^0.5]]]]]]

Plugging in the values given for "

For j= 1 to (3+RC(r13)+PC(r13))
If RR(j)=RR(r15), Then Next j
Print V$((RR(j)) (no line feed)
Next j

Print "gives " V$(RR(r15)) "=(("R(8)"*"R(9)")/("R(6)"*"R(7)"))*e^(("R(3)" "R(4)")/("R(1)"*"R(5)")"

Print "Thus," V$(RR(r15)) "= "R(RR(r(15))), U$(UU(RR(r15)))

Button available ANOTHER PROBLEM
Button available EXIT